package call.count;


import java.util.concurrent.atomic.AtomicInteger;

/**
 * 功能：记录方法信息
 *
 * @author baitao20
 * @date 2024/2/28 18:04
 **/
public class CallCountMethod {

    /**
     * 类型：
     * 1、Controller
     * 2、JMQ
     * 3、JSF
     * 4、JOB
     */
    private Integer type;

    /**
     * 类型：
     * 1、Controller
     * 2、JMQ
     * 3、JSF
     * 4、JOB
     */
    private String typeName;

    /**
     * 页面的请求路径。Controller 才会有值
     */
    private String url;

    /**
     * 调用次数
     */
    private AtomicInteger count;

    /**
     * 类名称
     */
    private String className;

    /**
     * 方法名称
     */
    private String methodName;

    /**
     * 是否拦截成功
     */
    private boolean adviceSuccess;

    public String buildFilterKey() {
        return String.join("_", this.className, this.methodName);
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public AtomicInteger getCount() {
        return count;
    }

    public void setCount(AtomicInteger count) {
        this.count = count;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public boolean isAdviceSuccess() {
        return adviceSuccess;
    }

    public void setAdviceSuccess(boolean adviceSuccess) {
        this.adviceSuccess = adviceSuccess;
    }

    @Override
    public String toString() {
        return "CallCountMethod{" +
                "type=" + type +
                ", typeName='" + typeName + '\'' +
                ", url='" + url + '\'' +
                ", count=" + count +
                ", className='" + className + '\'' +
                ", methodName='" + methodName + '\'' +
                ", adviceSuccess=" + adviceSuccess +
                '}';
    }
}